Skip to content

Allow hex colour input#6485

Open
TriviaSolari wants to merge 2 commits intospace-wizards:masterfrom
TriviaSolari:hex-colour-input
Open

Allow hex colour input#6485
TriviaSolari wants to merge 2 commits intospace-wizards:masterfrom
TriviaSolari:hex-colour-input

Conversation

@TriviaSolari
Copy link

@TriviaSolari TriviaSolari commented Mar 26, 2026

Adds a text box for entering and copying hex codes for colour selectors.

Why

In my experience this is a fairly standard feature for colour selectors to have. This also makes it less of a hassle to change colours when editing things like markings that allow for multiple colours, since now you can just copy and paste the hex code instead of having to do so for each channel.

Details

Resources/Locale/en-US/controls.ftl

  • New entry for the input label.

Robust.Client/UserInterface/Controls/ColorSelectorSliders.cs

  • New private members for the text box and corresponding label
    • LineEdit horizontally expands and is centred like the sliders are. IsValid is purposely omitted in favour of using the current colour as a fallback, as this triggers as soon as any character in the text box is changed, which prevents you from typing in a code manually if you wanted to do that for whatever reason
    • Colour is updated when the user either presses the Enter key within the text box, or when it loses focus
  • New private function OnHexInputValueChanged
    • Handles colour change logic, modified from OnSliderValueChanged
  • UpdateSliderVisuals now also sets the new text box to the hex representation of the current colour

Media

2026-03-25.20-27-55.mp4

And of course, this doesn't bypass colour restrictions for species like Vox or Vulpkanin:

2026-03-25.20-34-32.mp4

And the field only appears when the HSV/RGB sliders are enabled (IIRC this is only relevant for human skin colour?)

image

@TriviaSolari
Copy link
Author

Test fails appear to be a cargo crate sell value one, as well as something to do with stamina damage on a cleanbot, neither of which I touched in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant